// pages/payorder/payorder.js
const api = require("../../api/api")
const app = getApp()
Page({

    data: {
      id: '', 
      time:0,

      sendList:[],
      showAdress:true
    },
    sendIt(){
wx.showModal({
          title:'提示',
          content:'确定发货?',
          success:(res)=>{
            if (res.confirm) {
              console.log("确定")
              var that = this
              wx.request({
                url: api.changeOrderStatus.url,
                method:api.changeOrderStatus.method,
                data:{
                  id:this.data.id,
                  status:1
                },
                success:res=>{
                  console.log(res)
                  this.triggerEvent('lisConOrder',1)         
                  wx.navigateBack({
                    delta: 1,
                  })         
                }
              })
            } else if(res.cancel) {
              console.log("取消")
            }
          }
        })      
    },

    onLoad: function (options) {
      console.log(options)
      var that = this
      var list = JSON.parse(options.showSendList)
      this.setData({
        sendList:list,
        id:options.id
      })
      if(this.data.sendList[0].time){
        this.setData({
          showAdress:false
        })
      }
      console.log(this.data.sendList[0].time)
      console.log("1"+this.data.showAdress)
    }
   
})